﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Module;

public partial class main_admin_TestWS : System.Web.UI.Page
{
    string LICKEY = "M1g0VTFANIdhFTdYNVtm";
    Cmsystem.SystemWS ws;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            initUrl();

        } 

        ws = new Cmsystem.SystemWS();
        string url = DropDownList1.SelectedValue;
        if (url != "")
        {
            ws.Url = url;
        }      
    }

    /// <summary>
    /// 初始化接口URL
    /// </summary>
    public void initUrl() {
        ListItem it1 = new ListItem("http://iwb100.com/SystemWS.asmx");
        ListItem it2 = new ListItem("http://localhost:3066/Web/SystemWS.asmx");
        ListItem it3 = new ListItem("http://58.134.134.1:8080/SystemWS.asmx");
        DropDownList1.Items.Add(it1);
        DropDownList1.Items.Add(it2);
        DropDownList1.Items.Add(it3);
    }


    /// <summary>
    /// 查询
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btSelectDataTable_Click(object sender, EventArgs e)
    {       
        string sql = "";
        sql = TextBox1.Text;       
        DataTable dt= ws.GetDataTable(LICKEY, sql);
        this.Gridview1.DataSource = dt;
        this.Gridview1.DataBind();

    }

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btUpdateSql_Click(object sender, EventArgs e)
    {
        string sql = "";
        sql = TextBox1.Text;       
        ws.UpdateSql(LICKEY, sql); 
    }
}
